﻿$(function() {
  var findParam = location.href.search('#');
  var products = $('#product-features h3'),
	  hasParam = findParam > 0 && $(location.href.slice(findParam)).length>0,
	  active = (hasParam) ? $(location.href.slice(findParam)) : products.eq(0),
	  activeParent = active.parent(),
	  activeFeatures = active.next();

	  activeParent.addClass('active');
	  activeFeatures.show();

	  products.on('click',function (){
		   if($(this).parent().hasClass('active')){ return; }
		   activeParent.removeClass('active');
		   activeFeatures.fadeOut('normal');
		   $(this).parent().addClass('active');
		   $(this).next().fadeIn('normal');
		   activeParent = $(this).parent();
		   activeFeatures = $(this).next();
      })
})